package com.mojo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.StringJoiner;

/**
 * 车配置类
 * 1、示例@ConfigurationProperties和Component注解联合使用
 * 2、示例@ConfigurationProperties和@EnableConfigurationProperties注解联合使用
 *
 * @author <a href="mailto:mojo_jj@163.com">Mojo</a>
 */
 //@Component
@ConfigurationProperties(prefix = "cars")
public class Car {
    private String name;
    private Integer price;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", Car.class.getSimpleName() + "[", "]")
                .add("name='" + name + "'")
                .add("price=" + price)
                .toString();
    }
}
